// ForwardingSource.ts
import { BufferedSource } from './BufferedSource';
import { Source } from './Source';

export abstract class ForwardingSource implements Source {
  constructor(protected delegate: Source) {}

  Stream(callback: (chunk: Uint8Array, complete?:  boolean, error?: Error) => void) {
    this.delegate.Stream(callback);
  }

  readBytes(): Promise<Uint8Array> {
    return this.delegate.readBytes();
  }

  _isGzip: boolean = false;
  set isGzip(value: boolean) {
    this.delegate.isGzip = value
  }

  readString(): Promise<string> {
    return this.delegate.readString()
  }

  skipAll(): void {
    this.delegate.skipAll()
  }

  buffer(): BufferedSource {
    return this.delegate.buffer()
  }

  async read(sink: Uint8Array, byteCount: number): Promise<number> {
    return await this.delegate.read(sink, byteCount);
  }

  close(): void {
    this.delegate.close();
  }

}